<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="/layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Administrador de Grupo</f:facet>

		<s:decorate id="nome" template="/layout/display.xhtml">
            <ui:define name="label">Nome</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.nome}"/>
        </s:decorate>
		
		<s:decorate id="email" template="/layout/display.xhtml">
            <ui:define name="label">E-mail</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.email}"/>
        </s:decorate>
        
		<s:decorate id="dataCadastro" template="/layout/display.xhtml">
            <ui:define name="label">Data de Cadastro</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.dataCadastro.time}"/>
        </s:decorate>
        
		<s:decorate id="status" template="/layout/display.xhtml">
            <ui:define name="label">Status</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.status}"/>
        </s:decorate>

        <s:decorate id="logradouro" template="/layout/display.xhtml">
            <ui:define name="label">Logradouro</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.logradouro}"/>
        </s:decorate>

        <s:decorate id="numero" template="/layout/display.xhtml">
            <ui:define name="label">Número</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.numero}"/>
        </s:decorate>

        <s:decorate id="bairro" template="/layout/display.xhtml">
            <ui:define name="label">Bairro</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.bairro}"/>
        </s:decorate>

        <s:decorate id="complemento" template="/layout/display.xhtml">
            <ui:define name="label">Complemento</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.complemento}"/>
        </s:decorate>

        <s:decorate id="UF" template="/layout/display.xhtml">
            <ui:define name="label">Estado</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.UF}"/>
        </s:decorate>

        <s:decorate id="cidade" template="/layout/display.xhtml">
            <ui:define name="label">Cidade</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.cidade}"/>
        </s:decorate>
        
        <s:decorate id="CEP" template="/layout/display.xhtml">
            <ui:define name="label">CEP</ui:define>
            <h:outputText value="#{administradorGrupoHome.instance.CEP}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/resources/AdministradorGrupoEdit.xhtml"
                    id="edit"
                 value="Editar"/>

        <s:button view="/resources/#{empty administradorGrupoFrom ? 'AdministradorGrupoList' : administradorGrupoFrom}.xhtml"
                    id="done"
                 value="Concluído"/>

    </div>

    <rich:tabPanel switchType="ajax">

	    <rich:tab>
	        <f:facet name="label">
	            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Telefone</h:panelGroup>
	        </f:facet>
		    <h:form styleClass="association" id="telefoneChildren">
		
		        <h:outputText value="Não existe(m) telefone(s) associado(s)."
		                   rendered="#{empty administradorGrupoHome.telefone}"/>
		
		        <rich:dataTable value="#{administradorGrupoHome.telefone}"
		                       var="_telefone"
		                  rendered="#{not empty administradorGrupoHome.telefone}"
		                rowClasses="odd,even"
		                        id="telefoneTable"
		                       rows="10">
		            <rich:column sortBy="#{_telefone.contato}">
		                <f:facet name="header">Contato</f:facet>
		                <h:outputText value="#{_telefone.contato}"/>
		            </rich:column>
		            <rich:column sortBy="#{_telefone.numero}">
		                <f:facet name="header">Número</f:facet>
		                <h:outputText value="#{_telefone.numero}"/>
		            </rich:column>
		            <rich:column sortBy="#{_telefone.ramal}">
		                <f:facet name="header">Ramal</f:facet>
		                <h:outputText value="#{_telefone.ramal}"/>
		            </rich:column>
		            <rich:column sortBy="#{_telefone.tipoTelefone}">
		                <f:facet name="header">Tipo do Telefone</f:facet>
		                <h:outputText value="#{_telefone.tipoTelefone}"/>
		            </rich:column>
		            <rich:column styleClass="action" style="text-align: center;">
		                <f:facet name="header">Opções</f:facet>
		                <s:link id="selecttelefone"
		                     value="Selecionar"
		                      view="/resources/Telefone.xhtml" >
		                    <f:param name="telefoneId"
		                            value="#{_telefone.id}"/>
		                    <f:param name="telefoneFrom" value="AdministradorGrupo"/>
		                </s:link>
		            </rich:column>
		        </rich:dataTable>
		        
		        <br clear="left"/>
		        
		        <rich:datascroller for="telefoneTable" renderIfSinglePage="false" />
		
		    </h:form>
	
		    <div class="actionButtons">
		        <s:button
		               value="Novo Telefone"
		                view="/resources/TelefoneEdit.xhtml">
		            <f:param name="administradorGrupoId"
		                    value="#{administradorGrupoHome.instance.id}"/>
		            <f:param name="telefoneFrom" value="AdministradorGrupo"/>
		        </s:button>
		    </div>
	    </rich:tab>
	    
	    <rich:tab>
	    	<f:facet name="label">
	    		<h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Grupo</h:panelGroup>
	    	</f:facet>
	    	
	    	<h:form styleClass="association" id="grupoChildren">
		
		        <h:outputText value="Não existe(m) grupo(s) associado(s)."
		                   rendered="#{empty administradorGrupoHome.grupo}"/>
		
		        <rich:dataTable value="#{administradorGrupoHome.grupo}"
		                       var="_grupo"
		                  rendered="#{not empty administradorGrupoHome.grupo}"
		                rowClasses="odd,even"
		                        id="grupoTable">
		            <rich:column sortBy="#{_grupo.nome}">
		                <f:facet name="header">Nome</f:facet>
		                <h:outputText value="#{_grupo.nome}"/>
		            </rich:column>
		            <rich:column sortBy="#{_grupo.descricao}">
		                <f:facet name="header">Descrição</f:facet>
		                <h:outputText value="#{_grupo.descricao}"/>
		            </rich:column>
		            <rich:column sortBy="#{_grupo.email}">
		                <f:facet name="header">E-mail</f:facet>
		                <h:outputText value="#{_grupo.email}"/>
		            </rich:column>
		            <rich:column sortBy="#{_grupo.dataCadastro.time}">
		                <f:facet name="header">Data de Cadastro</f:facet>
		                <h:outputText value="#{_grupo.dataCadastro.time}"/>
		            </rich:column>
		            <rich:column sortBy="#{_grupo.status}">
		                <f:facet name="header">Status</f:facet>
		                <h:outputText value="#{_grupo.status}"/>
		            </rich:column>
		            <rich:column styleClass="action" style="text-align: center;">
		                <f:facet name="header">Opções</f:facet>
		                <s:link id="selectgrupo"
		                     value="Selecionar"
		                      view="/resources/Grupo.xhtml" >
		                    <f:param name="grupoId"
		                            value="#{_grupo.id}"/>
		                    <f:param name="grupoFrom" value="AdministradorGrupo"/>
		                </s:link>
		            </rich:column>
		        </rich:dataTable>
		
		    </h:form>
		    
		    <div class="actionButtons">
		        <s:button
		               value="Novo Grupo"
		                view="/resources/GrupoEdit.xhtml">
		            <f:param name="administradorGrupoId"
		                    value="#{administradorGrupoHome.instance.id}"/>
		            <f:param name="grupoFrom" value="AdministradorGrupo"/>
		        </s:button>
		    </div>
	    </rich:tab>
	    
	</rich:tabPanel>
</ui:define>

</ui:composition>
